import request from '@/utils/request'

// 查询签到列表
export function listSign(query) {
  return request({
    url: '/attendance/sign/list',
    method: 'get',
    params: query
  })
}

// 查询签到详细
export function getSign(signId) {
  return request({
    url: '/attendance/sign/' + signId,
    method: 'get'
  })
}

// 新增签到
export function addSign(data) {
  return request({
    url: '/attendance/sign',
    method: 'post',
    data: data
  })
}

/**
 * 发起人脸比对请求
 * @param {FormData} formData - 包含实时人脸图像和学生人脸特征数据的表单数据
 * @returns {Promise} - 返回一个 Promise 对象，用于处理请求结果
 */
export function compareFaces(formData) {
  return request({
    url: '/face/compare',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function uploadPhoto(formData) {
  return request({
    url: '/face/match',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

// 查询选课状态
export function getCourseSelectionStatus(courseRecordId) {
  return request({
    url: '/attendance/attendanceRecord/courseSelection/' + courseRecordId,
    method: 'get'
  })
}

// 修改签到
export function updateSign(data) {
  return request({
    url: '/attendance/sign',
    method: 'put',
    data: data
  })
}

// 删除签到
export function delSign(signId) {
  return request({
    url: '/attendance/sign/' + signId,
    method: 'delete'
  })
}
